package com.songlanyun.modules.marketing.groupbuy.controller.admin;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.songlanyun.common.validator.ValidatorUtils;
import com.songlanyun.modules.marketing.groupbuy.model.vo.GroupBuyOrderVO;
import com.songlanyun.modules.marketing.groupbuy.model.vo.GroupBuyTeamMemberSlimVO;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.songlanyun.modules.marketing.groupbuy.entity.GroupBuyTeamMember;
import com.songlanyun.modules.marketing.groupbuy.service.GroupBuyTeamMemberService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.common.utils.R;



/**
 * 拼团活动的成员
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-11-27 14:03:39
 */
@RestController
@RequestMapping("admin/groupbuy/teammember")
public class GroupBuyTeamMemberAdminController {
    @Autowired
    private GroupBuyTeamMemberService groupBuyTeamMemberService;

    /**
     * 拼团活动的成员列表
     * team_id
     * mobile
     * nickname
     */
    @RequestMapping("/list")
//   @RequiresPermissions("groupbuy:groupBuyTeamMember:list")
    public R page(@RequestParam Map<String, Object> params){
        List<GroupBuyTeamMemberSlimVO> groupBuyTeamMemberSlimVOS = groupBuyTeamMemberService.queryMembers(params);
        return R.ok().put("list", groupBuyTeamMemberSlimVOS);
    }

    /**
     * 查询拼团成员订单
     */
    @GetMapping("/teamorder/{orderId}")
    public R teamOrder(@PathVariable("orderId") Long orderId) {
        GroupBuyOrderVO vo = groupBuyTeamMemberService.getByMemberOrder(orderId);
        return R.ok().put("data", vo);
    }

}
